<template>
		<view class="content">
			<!-- 顶部轮播 -->
			<u-swiper :list="list" height="300"></u-swiper>
			<!-- 模块按钮部分 -->
			<view class="dis_f_sb_c top_btn">
				<view class="btns dis_f_co_c_c" @click="goxxpt()">
					<image src="../../static/index/16122578694645.png" mode=""></image>
					<view>信息平台</view>
				</view>
				<view class="btns dis_f_co_c_c">
					<image src="../../static/index/16372891687536.png" mode=""></image>
					<view>小视频</view>
				</view>
				<view class="btns dis_f_co_c_c">
					<image src="../../static/index/16122580993342.png" mode=""></image>
					<view>商城中心</view>
				</view>
				<view class="btns dis_f_co_c_c">
					<image src="../../static/index/16238151739160.png" mode=""></image>
					<view>商家</view>
				</view>
				<view class="btns dis_f_co_c_c">
					<image src="../../static/index/16238151739160.png" mode=""></image>
					<view>直播</view>
				</view>
			</view>
			<!-- 超值商品 -->
			<image class="cz_sp" src="../../static/index/bg-discount.jpg" mode=""></image>
			<!-- 分类信息 -->
			<view class="dis_f_co">
				<u-tabs :list="tab" :is-scroll="false" :current="current" @change="change"></u-tabs>
				<view class="dis_f_w">
					<view class="list " v-for="(item,index) in lists">
						<view style="background-color: #fff;" @click="gidetail(item.id)">
							<image :src="item.pic" ></image>
							<view class="dis_f_co" style="padding: 10rpx;">
								<view class="title hh slh_one" >{{item.title}}</view>
								<view class="time slh_one">{{item.address}}</view>
								<view class="time">{{item.pubdate}}</view>
								
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</template>

	<script>
		export default {
			data() {
				return {
					tab: [{
						name: '全部'
					}, {
						name: '租房'
					}, {
						name: '求职'
					}, {
						name: '商家'
					}],
					current: 0,
					list: [],
					lists: [],
				}
			},
			onLoad() {
						this.getindexbanner()
						this.getlist(0) 
			},
			methods: {
				gidetail(e){
					uni.navigateTo({
						url:'../info/info?cate='+this.current+'&id='+e
					})
				},
				change(index) {
					this.current = index;
					this.getlist(index)
				},
				
				getlist(e){
					this.$.ajax(2, 'post', 'geilist', {
						cate:e,
						sid:0,
						uid: uni.getStorageSync('uid'),
						// page:this.page
					}, (res) => {
						// console.log(res)
						if (res.code == 1) {
							this.lists = res.list
						
						}
					})
					
				},
				getindexbanner(){
					this.$.ajax(2, 'post', 'getindexbanner', {
						// uid: uni.getStorageSync('uid'),
						// page:this.page
					}, (res) => {
						// console.log(res)
						if (res.code == 1) {
							this.list = res.list
						
						}
					})
				},
				goxxpt(){
					uni.navigateTo({
						url:'../info/xx_pt'
					})
				}
			}
		}
	</script>

	<style lang="scss">
		.content {
			.top_btn {
				padding: 30rpx 40rpx;
				background-color: #fff;
				border-bottom: 1rpx solid #eee;

				.btns {
					image {
						width: 80rpx;
						height: 80rpx;
						margin-bottom: 10rpx;
					}
				}
			}

			.cz_sp {
				width: 100%;
				height: 200rpx;
			}
			.list{
				padding: 10rpx;
				width: 50%;
				border-radius: 10rpx;
				// background-color: #fff;
				// flex: 1;
				.title{
					font-size: 32rpx;
					margin-bottom: 10rpx;
				}
				.time{
					color: #999;
				}
				image{
					width: 100%;
					height: 280rpx;
					margin-right: 20rpx;
					border-radius: 10rpx 10rpx 0 0;
				}
			}
		}
	</style>
